<script>
// Date：https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Date
function getDateString() {
  const weekday = '日一二三四五六'.split('')
  const time = (n) => n<10 ? `0${n}`:`${n}`
  const date = new Date() // 当前时间
  const d = date.getDay() // 星期几
  const h = date.getHours() // 小时
  const m = date.getMinutes() // 分钟
  const s = date.getSeconds() // 秒

  return `今天是星期${weekday[d]}，现在的时间${
    time(h)}:${time(m)}:${time(s)}`
}
console.log(getDateString())

function triangleArea(a, b, c) {
  const s = (a+b+c)/2
  return Math.sqrt(
    s * (s-a) * (s-b) * (s-c)
  )
}

function isLeapYear(y) {
  if (y % 100 === 0) {
    return y % 400 === 0
  } else {
    return y % 4 === 0
  }
}

</script>
<div id="c"></div>
<script>
let c = document.getElementById('c')
function loopWord(word) {
  let i = 0
  setInterval(() => {
    const w = word.slice(i%word.length)
      + word.slice(0, i%word.length)
    c.innerText = w
    i++
  }, 100)
}
loopWord('helloworld')

function findYears() {
  return [...Array(2100-2020)]
    .map((_,index) => 2021+index)
    .filter((y) => {
      const d = new Date(y, 0, 1)
      return d.getDay() === 0
    }
  )
}

console.log(findYears())

</script>